package com.faryangsh.enumpack.mutilChannel;

import java.util.EnumMap;

import static com.faryangsh.enumpack.mutilChannel.GameOutcome.*;
/**
 * Created by 杨志远 on 2017/8/31
 * email faryangsh@163.com.
 */
public enum  EnumWithArray {
    ROCK,SCISSORS,PAPER;
    private static GameOutcome[][] table={
        {DRAW,WIN,LOSE},
        {LOSE,DRAW,WIN},
        {WIN,LOSE,DRAW}
    };
    public GameOutcome complate(EnumWithArray oppent){
        return table[this.ordinal()][oppent.ordinal()];
    }

    public static void main(String[] args) {
        System.out.println("result:"+ROCK.complate(PAPER));

        EnumWithArray[] enumConstants = EnumWithArray.class.getEnumConstants();
        System.out.println(enumConstants[1]);
        EnumWithArray[] values = EnumWithArray.values();

    }
}
